<template>
	<view class="notice">
		<view v-if="noticeList.length > 0">
			<view class="container" style="height: 1px;background: #f3f3f3;"></view>
			<view class="container bgF   flex-xy" v-for="(items, i) in noticeList" v-bind:key="i" @click="toNoticeDetail(i)">
				<view class="w95 flex-spc-x pt20 pb20">
					<view class="w90 tal ">
						<view class="fs30 co333 w100 textOver mb20">{{ items.noticeTitle }}</view>
						<view class="fs26" style="color: #646464;">
							<u-icon name="clock" color="#646464" size="28" class="verticalM"></u-icon>
							<text class="ml10 verticalM">{{ items.createTime }}</text>
						</view>
					</view>
					<view class="w10 tar"><u-icon name="arrow-right" color="#a0a0a0"></u-icon></view>
				</view>
				<view class="container" style="height: 1px;background: #f3f3f3;"></view>
			</view>

			<view class="container  mt20 mb20" style="background: #f3f3f3;"><u-divider color="#CCC" bg-color="#f3f3f3">~到底了,宝贝~</u-divider></view>
		</view>
		<view v-else class="container flex-xy">
			<view class="w100" style="height: 92rpx;"></view>
			<image src="../../static/noMsg.png" mode="widthFix" style="width: 60%;" class="pt50"></image>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			pageSize: 11, //每页数量
			pageNum: 1, //页码
			noticeList: [],
			notice: [
				{ title: '2020年矿机新盘龙头项目——ROB 千篇一律的矿机盘如何在这个到处开花的市场脱颖而出？', time: '2020-04-22' },
				{ title: 'ROB 千篇一律的矿机盘？', time: '2020-04-23' },
				{ title: '如何在这个到处开花的？', time: '2020-04-24' },
				{ title: '到处开花的市场？', time: '2020-04-25' },
				{ title: '2020年矿机新盘龙头项目——ROB 千篇一律的矿机盘如何在这个到处开花的市场脱颖而出？', time: '2020-04-22' },
				{ title: 'ROB 千篇一律的矿机盘？', time: '2020-04-23' },
				{ title: '如何在这个到处开花的？', time: '2020-04-24' },
				{ title: '到处开花的市场？', time: '2020-04-25' }
			]
		};
	},
	methods: {
		// 去具体详情
		toNoticeDetail(index){
			uni.navigateTo({
				url:`/pages/more/noticeDeatil?index=${index}`
			})
		},
		// GET/mobileUser/notice/list获取通知公告列表
		getNoticeList() {
			var postObj = { url: '/mobileUser/notice/list', data: { pageNum: this.pageNum, pageSize: this.pageSize } };
			this.getRequest(postObj)
				.then(res => {
					// console.log('res获取通知公告列表', res);
					if (res.data.code == 200) {
						this.noticeList = [...this.noticeList, ...res.data.rows];
					}
				})
				.catch(err => {
					// console.log('err获取通知公告列表', err);
				});
		}
	},
	onLoad() {
		this.getNoticeList();
	},
	onReachBottom() {
		this.pageNum = this.pageNum + 1;
		this.getNoticeList();
	}
};
</script>

<style lang="less" scoped></style>
